<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?>
<?php $this->load->view('common/head'); ?>

<?php $this->load->view('common/header'); ?>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <?php $this->load->view('common/sidebar'); ?>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <?php $this->load->view('common/breadcrumbs'); ?>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">

                <?php $this->load->view('common/set'); ?>

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <form class="form-horizontal" action="" method="post">
                            <div class="space-4"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="is_rewrite"> 订单编号 </label>
                                <div class="col-sm-9">
                                    <div class="radio">
                                        <label> <?php echo $order['order_no']; ?>
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="space-4"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="is_rewrite"> 下单日期 </label>
                                <div class="col-sm-9">
                                    <div class="radio">
                                        <label> <?php echo date("Y-m-d H:i", $order['order_add_time']); ?>
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="space-4"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="is_rewrite"> 订单商品总价 </label>
                                <div class="col-sm-9">
                                    <div class="radio">
                                        <label> ¥
                                            <span class="good_price"
                                                  price="<?php echo $order['good_price']; ?>"><?php echo $order['good_price']; ?></span>
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="space-4"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="is_rewrite"> 订单总价 </label>
                                <div class="col-sm-9">
                                    <div class="radio">
                                        <label class="col-md-2 col-xs-6 col-sm-4"> ¥
                                            <span class="order_price"><?php echo $order['order_price']; ?></span>
                                        </label>
                                        <span class="help-block col-sm-reset inline hidden-480" id="order_price_tips">(
                                                    <b id="service_fee_tips">包含2%的服务费</b>
                                            <?php if ($order['is_kaipiao'] == 1) { ?>
                                                <b id="kaipiao_fee_tips">,10%的开票费</b>
                                            <?php } ?>
                                            <?php if ($order['is_songhuo'] == 1) { ?>
                                                <b id="songhuo_fee_tips">,¥：<?php echo $order['songhuo_fee']; ?>的送货费</b>
                                            <?php } ?>
                                            )
                                                </span>
                                    </div>
                                </div>
                            </div>
                            <div class="space-4"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="voucher_close">
                                    支付方式 </label>
                                <div class="col-sm-9">
                                    <div class="radio">
                                        <?php if ($order['order_pay_type'] == 2) { ?>
                                            <label class="col-md-2 col-xs-6 col-sm-4">
                                                <span class="lbl"> 线下支付</span>
                                            </label>
                                        <?php } ?>
                                        <?php if ($order['order_pay_type'] == 1) { ?>
                                            <label class="col-md-2 col-xs-6 col-sm-4">
                                                <span class="lbl"> 销售贷支付</span>
                                            </label>
                                        <?php } ?>
                                        <?php if ($order['order_pay_type'] == 0) { ?>
                                            <label class="col-md-2 col-xs-6 col-sm-4">
                                                <span class="lbl"> 待支付</span>
                                            </label>
                                        <?php } ?>
                                    </div>
                                </div>
                            </div>
                            <div class="space-4"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="voucher_close">
                                    是否开票 </label>
                                <div class="col-sm-9">
                                    <div class="radio">
                                        <?php if ($order['is_kaipiao'] == 1) { ?>
                                            <label class="col-md-2 col-xs-6 col-sm-4">
                                                <span class="lbl"> 是</span>
                                            </label>
                                        <?php } else { ?>
                                            <label class="col-md-2 col-xs-6 col-sm-4">
                                                <span class="lbl"> 否</span>
                                            </label>
                                        <?php } ?>
                                    </div>
                                </div>
                            </div>
                            <div class="space-4"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="voucher_close">
                                    是否送货 </label>
                                <div class="col-sm-9">
                                    <div class="radio">
                                        <?php if ($order['is_songhuo'] == 1) { ?>
                                            <label class="col-md-2 col-xs-6 col-sm-4">
                                                <span class="lbl"> 是</span>
                                            </label>
                                        <?php } else { ?>
                                            <label class="col-md-2 col-xs-6 col-sm-4">
                                                <span class="lbl"> 否</span>
                                            </label>
                                        <?php } ?>
                                    </div>
                                </div>
                            </div>
                            <div class="space-4"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="is_rewrite"> 收货信息 </label>
                                <div class="col-sm-9">
                                    <div class="radio">
                                        <label>
                                        <span class="lbl">
                                            <?php echo $dress['dress_uname']; ?>&nbsp;&nbsp;&nbsp;
                                            <?php echo $dress['dress_utel']; ?>&nbsp;&nbsp;&nbsp;
                                            <?php echo $dress['dress_city'] . $dress['dress_udress']; ?>
                                        </span>
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="space-4"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="is_rewrite"> 交货日期 </label>
                                <div class="col-sm-9">
                                    <div class="radio">
                                        <label><?php echo !empty($order['good_date']) ? $order['good_date'] : '---'; ?>
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="space-4"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="is_rewrite"> 订单备注 </label>
                                <div class="col-sm-9">
                                    <div class="radio">
                                        <label><?php echo !empty($order['remark']) ? $order['remark'] : '无'; ?>
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </form>
                        <table class="table table-striped table-bordered">
                            <thead>
                            <tr>
                                <th>商品名称</th>
                                <th>规格</th>
                                <th>单价</th>
                                <th>工艺</th>
                                <th>工艺图</th>
                                <th>料号</th>
                                <th>下单数量（个）</th>
                                <th>单笔总金额（元）</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if ($order_list) {
                                foreach ($order_list as $key => $val) { ?>
                                    <tr>
                                        <td><?php echo $val['good_name']; ?></td>
                                        <td><?php echo $val['good_memo']; ?></td>
                                        <td><?php echo $val['per_good_price']; ?></td>
                                        <td><?php echo $val['good_content']; ?></td>
                                        <td>
                                            <img onclick='show_img("<?php echo $val['good_cover']; ?>")' src="<?php echo $val['good_cover']; ?>" alt="" width="100px">
                                        </td>
                                        <td><?php echo !empty($val['good_part_number']) ? $val['good_part_number'] : '---'; ?></td>
                                        <td><?php echo $val['good_mum']; ?></td>
                                        <td class="center">
                                            <?php echo $val['good_price']; ?>
                                        </td>
                                    </tr>
                                <?php }
                            } ?>
                            </tbody>
                        </table>
                        <input type="hidden" id="uid" name="uid" value="<?php if (!empty($member['user_id'])) {
                            echo $member['user_id'];
                        } ?>">
                        <div class="col-md-offset-2 col-md-9">
                            <span class="btn btn-purple btn-sm" id="back_index">
                                <span class=" icon-on-right bigger-110"></span>
                                返回
                            </span>
                        </div>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <?php $this->load->view('common/footer'); ?>
</div><!-- /.main-container -->

<?php $this->load->view('common/footerjs'); ?>
<!-- inline scripts related to this page -->
<script type="text/javascript">

    function show_img(path) {
        console.log(path);
        //页面层
        layer.open({
            type: 1,
            skin: 'layui-layer-rim', //加上边框
            area: ['80%', '80%'], //宽高
            shadeClose: true, //开启遮罩关闭
            end: function (index, layero) {
                return false;
            },
            content: '<div style="text-align:center"><img src="' + path+ '" /></div>',
        });
    }

    function return_money(id) {

        var locationurl = baseurl + "index.php/manage/member/return_money";
        $.ajax({
            url: locationurl,
            type: "get",
            data: {'return_id': id},
            dataType: 'json',
            success: function (data) {
                console.log(data);
                if (data.code == 200) {
                    layer.msg('还款成功', {
                        time: 1000, //1s后自动关闭
                        shade: 0.1
                    }, function () {
                        window.location.href = window.location.href;
                    });
                } else {
                    console.log(data);
                    layer.msg(data.msg);
                }
            }
        });
    }

    $("#back_index").click(function () {
        window.location.href = baseurl + "index.php/manage/orders/index";
    });

</script>
</body>
</html>
